package com.atguigu.gmall.all;

import com.atguigu.gmall.common.interceptors.FeignInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)//取消数据源自动配置,即仅仅引jar包，但不自动装配，因为本模块不需要连接数据库，是业务层如商品层微服务才需要直接连数据库
@ComponentScan({"com.atguigu.gmall"})
@EnableDiscoveryClient
@EnableFeignClients(basePackages= {"com.atguigu.gmall"})
public class WebAllApplication {

    public static void main(String[] args) {
        SpringApplication.run(WebAllApplication.class, args);
    }



    //创建FeignInterceptor 拦截器 到web-all微服务的SpringIOC容器中
    //这个注解使得哪里用直接哪里拦截，不会出现全局所有请求如首页不用登录的页面都拦截的情况,这样就不用在common中加@Component注解了
    @Bean
    public FeignInterceptor feignInterceptor(){
        return new FeignInterceptor();
    }



}

